The sample program expects to transform
the characters on the second line into an int
,
but this cannot be done.
Here is what happens with this defective input file:
C:\users\default\JavaLessons>java AddTwo < input.txt Enter first number: Enter second number: java.lang.NumberFormatException: seven D:\users\default\JavaLessons>
The system reports that there is an error in the input, causing a "Number Format Exception." The program stops when it encounters this exception.